Provides blocking and bounding capabilities for thread-safe collections that
implement IProducerConsumerCollection<(Of <(T>)>).
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
<ComVisibleAttribute(False)> _ <HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization := True, _ ExternalThreading := True)> _ Public Class BlockingCollection(Of T) _ Implements IEnumerable(Of T), ICollection, IEnumerable, _ IDisposable |
C# |
---|
[ComVisibleAttribute(false)] [HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true, ExternalThreading = true)] public class BlockingCollection<T> : IEnumerable<T>, ICollection, IEnumerable, IDisposable |
Type Parameters
- T
- Specifies the type of elements in the collection.
Remarks
IProducerConsumerCollection<(Of <(T>)>) represents a collection
that allows for thread-safe adding and removing of data.
BlockingCollection<(Of <(T>)>) is used as a wrapper
for an IProducerConsumerCollection<(Of <(T>)>) instance, allowing
removal attempts from the collection to block until data is available to be removed. Similarly,
a BlockingCollection<(Of <(T>)>) can be created to enforce
an upper-bound on the number of data elements allowed in the
IProducerConsumerCollection<(Of <(T>)>); addition attempts to the
collection may then block until space is available to store the added items. In this manner,
BlockingCollection<(Of <(T>)>) is similar to a traditional
blocking queue data structure, except that the underlying data storage mechanism is abstracted
away as an IProducerConsumerCollection<(Of <(T>)>).
Inheritance Hierarchy
System..::.Object
System.Collections.Concurrent..::.BlockingCollection<(Of <(T>)>)
System.Collections.Concurrent..::.BlockingCollection<(Of <(T>)>)